<!DOCTYPE html>
<html lang="zh-CN">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Vue 3 Setup 语法示例</title>
</head>

<body>
    <div id="app">
        <button @click="handleGo">打开豆包</button>
        <button @click="handleUpload">上传文件</button>

        <button @click="handleGptGo">打开GPT</button>
        <button @click="handleGptUpload">GPT上传文件2</button>
    </div>

    <!-- 引入 Vue 3 和 Axios -->
    <script src="https://cdn.jsdelivr.net/npm/vue@3.4.21/dist/vue.global.min.js"></script>
    <script src="https://cdn.jsdelivr.net/npm/axios@1.6.7/dist/axios.min.js"></script>

    <script>
        const { createApp, ref, reactive } = Vue;

        createApp({
            setup() {

                const handleUpload = () => {
                    axios.get('/db/upload')
                };

                const handleGo = () => {
                    axios.get('/db/go')
                };


                const handleGptGo = () => {
                    axios.get('/gpt/go')
                };

                const handleGptUpload = () => {
                    console.log('handleGptUpload');
                    axios.get('/gpt/upload')
                };

                return {
                    handleUpload, handleGo, handleGptGo, handleGptUpload
                };
            }
        }).mount('#app');
    </script>
</body>

</html>